@use '../variables';
@use '../mixins';

@include mixins.b(alert) {
  --color: var(--#{variables.$prefix}alert-color);
  --background-color: var(--#{variables.$prefix}alert-background-color, var(--#{variables.$prefix}background-color-light-gray));

  display: flex;
  align-items: center;
  padding: 6px 16px;
  background-color: var(--background-color);
  border: 1px solid var(--color, var(--#{variables.$prefix}color-border));

  @include mixins.m(success) {
    --color: var(--#{variables.$prefix}alert-color, var(--#{variables.$prefix}color-success));
    --background-color: var(--#{variables.$prefix}alert-background-color, var(--#{variables.$prefix}background-color-success));
  }

  @include mixins.m(warning) {
    --color: var(--#{variables.$prefix}alert-color, var(--#{variables.$prefix}color-warning));
    --background-color: var(--#{variables.$prefix}alert-background-color, var(--#{variables.$prefix}background-color-warning));
  }

  @include mixins.m(error) {
    --color: var(--#{variables.$prefix}alert-color, var(--#{variables.$prefix}color-danger));
    --background-color: var(--#{variables.$prefix}alert-background-color, var(--#{variables.$prefix}background-color-danger));
  }

  @include mixins.m(info) {
    --color: var(--#{variables.$prefix}alert-color, var(--#{variables.$prefix}color-primary));
    --background-color: var(--#{variables.$prefix}alert-background-color, var(--#{variables.$prefix}background-color-primary));
  }

  @include mixins.m(with-title) {
    align-items: flex-start;

    @include mixins.e(icon) {
      font-size: calc(var(--#{variables.$prefix}font-size-title) * 1.5);
    }

    @include mixins.e(content) {
      display: block;
    }

    @include mixins.e(message) {
      padding-top: 1px;
    }
  }

  @include mixins.e(icon) {
    padding: 5px 0;
    margin-right: 10px;
    font-size: 1.5em;
    color: var(--color);
  }

  @include mixins.e(content) {
    display: flex;
    flex: 1 0 0;
    align-items: center;
  }

  @include mixins.e(message) {
    flex: 1 0 0;
    padding: 5px 0;
  }

  @include mixins.e(header) {
    display: flex;
    align-items: flex-start;
  }

  @include mixins.e(title) {
    flex: 1 0 0;
    padding: 5px 0;
    font-size: var(--#{variables.$prefix}font-size-title);
    font-weight: var(--#{variables.$prefix}font-weight-bold);
  }

  @include mixins.e(close) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    margin: 0 0 0 8px;
    font: inherit;
    font-size: 1.25em;
    line-height: 1;
    white-space: nowrap;
    vertical-align: top;
    appearance: none;
    cursor: pointer;
    background-color: transparent;
    border: none;
    border-radius: 50%;
    outline: none;
    transition:
      color var(--#{variables.$prefix}animation-duration-base) linear,
      background-color var(--#{variables.$prefix}animation-duration-base) linear;

    &:hover,
    &:focus {
      background-color: var(--#{variables.$prefix}background-color-hover);
    }

    &:active {
      color: var(--#{variables.$prefix}color-dark-primary);
    }
  }
}
